home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / bled16.arc / BLED.DOC < prev    next >
Encoding:
Text File  |  1987-03-21  |  32.3 KB  |  725 lines

  1.      DOCUMENTATION for BLED version 1.61
  2.      by Ken Goosens, 5020 Portsmouth Road, Fairfax, VA 22032
  3.      21 March 1987
  4.  
  5.      **********************************************************************
  6.      * BLED is copyrighted by its author.  BLED can be freely distributed *
  7.      * by non-profit organizations and bulletin boards.  BLED cannot be   *
  8.      * distributed commercially nor included in any commercial product    *
  9.      * without the explicit written consent of the author.  Individuals   *
  10.      * are encouraged to give free copies to other individuals.           *
  11.      *    All rights to the code are held by the author and any use       *
  12.      * or modification of the code requires permission of the author.     *
  13.      **********************************************************************
  14.  
  15.      BLED is supported by its author.  Individuals are encouraged to report
  16.      bugs, suggest enhancements, or, preferably, to make improvements to
  17.      the code available to others through the author.
  18.  
  19.      BLED should be distributed with the following files:
  20.  
  21.      BLED.DOC - this file
  22.      BLED.EXE - compiled, executable code
  23.      BLED.BAS - main program source code
  24.      UTILBLED.BAS - separately compiled subprograms used in BLED
  25.  
  26.      BLED uses assembler subroutines from the fine library ADVBAS by 
  27.      TOM HANLIN.  The author has paid Tom Hanlin for rights to use his
  28.      code.
  29.  
  30.      CONTENTS
  31.  
  32.      What is BLED
  33.      What Use is BLED
  34.      What are the Advantages of BLED
  35.      New Features of BLED
  36.      How Does BLED Work
  37.      How do you Identify Lines
  38.      Line Number Merging
  39.      How to Invoke BLED
  40.      How BLED Runs
  41.      The Major BLED Functions
  42.      CONFIGURE
  43.      FILE COMPARE
  44.      LINE MERGE
  45.      MERGE
  46.      Stylistic Considerations
  47.      How to Recompile BLED
  48.  
  49.      What is BLED
  50.  
  51.      BLED is  a Batch Line EDitor.  Editor - because it changes text files.
  52.      Line - because  it  operates  on  entire  lines  of  text  rather than
  53.      individual characters  or phrases.  And batch - because the changes to
  54.      be made are not  specified interactively,  but are  pre-specified in a
  55.      file describing the changes, which is created outside of BLED.
  56.  
  57.  
  58.      What Use is BLED?
  59.  
  60.      BLED is  most useful when different people have to communicate changes
  61.      to a text file that they jointly maintain.  The typical use of BLED is
  62.      for producing  modifications to source code for programs.  Interactive
  63.      Microsoft BASIC has long had  a  MERGE  command  which  functions like
  64.      BLED.  It  inserts, deletes, and replaces lines based on line numbers.
  65.      Other public domain programs  would  compare  two  BASIC  programs and
  66.      produce  a  merge  file  to  convert  one to the other using the merge
  67.      command.  BLED  is  a  generalized  program  that  combines  these two
  68.      functions.
  69.  
  70.  
  71.      What are the Advantages of BLED?
  72.  
  73.      o    Lines of text do not have to be numbered.
  74.  
  75.      This means  that BLED  will work with source code that allows lines of
  76.      code to have no  numbers, including  Mircosoft QuickBASIC,  as well as
  77.      Pascal and other languages.
  78.  
  79.      o    Comment lines are supported.
  80.  
  81.      BLED comment  lines are  completely ignored  when merging.  This means
  82.      that documentation  can be  included right  inside a  BLED merge file.
  83.      One of  the disadvantages of the BASIC merge command was that the only
  84.      type of line possible was BASIC  code,  so  that  documentation  for a
  85.      merge always had to be included in a separate file.
  86.  
  87.      o    Logical lines can span multiple physical lines.
  88.  
  89.      One of  the more  disagreeable features of old BASIC was that a single
  90.      line of code (i.e. a line beginning with a  number) had  to be  on one
  91.      physical   line.    Newer   languages   like   QuickBASIC   support  a
  92.      line-continuation character (e.g the underscore) that  allows the same
  93.      logical line  to span  multiple physical lines.  This greatly improves
  94.      the readability of source  code by  allowing grouping  by indentation.
  95.      BLED recognizes and supports logical lines.
  96.  
  97.      o    Can be run batch from DOS, or interactively.
  98.  
  99.      Commands telling  BLED what  to do  can be specified as DOS arguments,
  100.      and BLED has a batch mode in which it will run without further prompts
  101.      and return  automatically to  DOS.  BLED will prompt for any arguments
  102.      it needs which are not specified.
  103.  
  104.      o    Configurable.
  105.  
  106.      BLED comes pre-set to  work  with  Microsoft  QuickBASIC,  but  can be
  107.      configured to work with different languages.
  108.  
  109.  
  110.      New Features of BLED
  111.  
  112.      BLED 1.61 adds beeps at the end of a batch run.
  113.  
  114.      BLED 1.6 fixes 3 bugs.
  115.  
  116.         o   The main prompt now includes option "F" (file compare) in
  117.             its short list of valid responses.
  118.  
  119.         o   When preserving BLED comments, a source BLED comment no
  120.             longer adds an extra space when converted to a BLED comment
  121.             in a file compare.
  122.  
  123.         o   When preserving BLED comments, a merge floats bled comments
  124.             above the line only when the bled comment is in a continued
  125.             line instead of always.
  126.  
  127.      This change allows BLED source comments to a line to be added just
  128.      above its line number, a BLED file compare to be created, and when the
  129.      resultant merge is applied, the BLED comments will no longer be one
  130.      line higher than they should be.  Now the comments will remain in
  131.      place.
  132.  
  133.  
  134.                          History of Other Changes
  135.  
  136.      BLED 1.5 has two major enhancements, some bug fixes, and some
  137.      cosmetic changes.
  138.  
  139.     o   A new option to support preserving BLED comments.
  140.  
  141.      On a merge, BLED comment lines were always eliminated and there
  142.      was no way to put temporarily comments on changes as source code
  143.      comments.  Now there is a configuration parameter that will cause
  144.      BLED comment lines to be converted to a specially formatted source
  145.      code comment lines in a merge and, conversely, convert these special
  146.      source code comments to BLED comments when doing a file compare to
  147.      produce a merge.  This change allows programmers to work with equal
  148.      fecility with merges or directly on the full program and readily
  149.      document changes and yet easily remove these temporary comments
  150.      when the code is put into production.
  151.  
  152.      Other changes in 1.5 included:
  153.  
  154.          o   BLED is about 33% faster because it has been recompiled
  155.              under QUICKBASIC 2.0.
  156.  
  157.          o   The automatic documentation in a file compare has been
  158.              enhanced to include the date and file size of the old
  159.              version of the code so that there is no ambiguity about
  160.              what version of the code the new merge goes against.
  161.  
  162.          o   A bug has been fixed that caused the character used for
  163.              a source code remark not to be read in properly from a
  164.              configuration file.
  165.  
  166.          o   A bug has been fixed that caused the maximum number of
  167.              physical lines allowed in a logical line not to be read
  168.              in properly from a configuration file.
  169.  
  170.          o   Status line reports now use a mixture of upper and lower
  171.              case rather than all upper case.  This improves readability
  172.              and reserves all upper case words for special emphasis.
  173.  
  174.          o   When a file is missing and the proper name is entered,
  175.              the status line is now properly restored.
  176.  
  177.          o   When the user Quits in interactive mode, the cursor is
  178.              left at the bottom of the screen rather than in the middle
  179.              of previous text.
  180.  
  181.          o   A parameter has been added which was in the code but missing
  182.              from the documentation.  Other parts of the documentation
  183.              have been added or made more thorough, including a statement
  184.              of distribution rights and how to recompile BLED.
  185.  
  186.      BLED 1.4 had one major change.  Output is now internally buffered.
  187.      Before, every line was written out immediately.  Now up to 100 lines
  188.      are held internally before writing.  This dramatically reduces the
  189.      number of disk i/o's and reduces the head movement, usually making
  190.      the program faster.  My test showed a 12% improvement with RBBS.
  191.          The only other change is that the default maximum number of lines
  192.      between line numbers is now 400 rather than 200.
  193.  
  194.      BLED 1.3 fixes a bug.  If a line begins with a comment other than in
  195.      column 1 and ends with a line continuation character (e.g. source code
  196.      commented out), BLED would get not correctly identify the line as a
  197.      comment and would get an illegal function call.
  198.  
  199.      BLED 1.2 has two two features: (1) autodocumenting merge, and (2) test
  200.      run mode.
  201.  
  202.      AUTODOCUMENTING.   When you do a file compare to produce a merge, BLED
  203.      produces a  header on  what files were used to make the merge and date
  204.      and time stamps the merge.  Also, BLED  produces a  header comment for
  205.      each change indicating whether the line is being INSERTED, DELETED, or
  206.      REPLACED (changed).  Also, for replacement lines longer than one line,
  207.      BLED will insert a comment marking the first different line.
  208.  
  209.      TEST MODE.   There is a new "T" (for Test) parameter.  This limits the
  210.      run to a specificed number of logical lines in the  master file.   You
  211.      will not normally use this parameter.
  212.  
  213.  
  214.      How Does BLED Work?
  215.  
  216.      Like a  block editor.   Think of how you would work with a full screen
  217.      text editor, if you  had to  work from  the top  to the  bottom of the
  218.      file.  You basically do two things:
  219.  
  220.      o    Mark a block of lines.
  221.  
  222.      o    Say what  to do  with the block - either keep, delete, or replace
  223.           by another block of code; or insert a block of code.
  224.  
  225.      BLED has a BLOCK command to identify the block of text, followed  by a
  226.      disposition  command  of  KEEP,  DELETE,  REPLACE, or INSERT.  This is
  227.      BLED's general MERGE.
  228.  
  229.  
  230.      How do You Identify Lines?
  231.  
  232.      You have to specify what blocks of lines you want to work with.  There
  233.      are three ways.
  234.  
  235.      o    By physical line number.
  236.  
  237.      The  absolute  physical  line  numbers are 1,2,3,etc. for each line of
  238.      text.  Relative lines can also  be  specified,  e.g. from  the current
  239.      position in the file forward three lines.
  240.  
  241.      o    By line labels.
  242.  
  243.      Line labels  are identifiers  or names  for lines.  BLED supports both
  244.      numeric line labels (it calls  them  label  numbers)  and alphanumeric
  245.      labels (simply labels).  BLED ASSUMES THAT A LINE LABEL OCCURS ONLY AS
  246.      THE FIRST WORD ON A LINE.  Some  languages allow  labels to  be put in
  247.      the  middle  of  a  physical  line,  but  this is bad practice because
  248.      interior labels are hard to find.
  249.  
  250.      o    By strings.
  251.  
  252.      Strings are just sequences of characters that can occur inside lines.
  253.  
  254.      So, in BLED, a block can be identified as beginning or ending  with an
  255.      absolute or relative line number, a line label, or a string.  And so a
  256.      block can be defined as
  257.  
  258.           the first five lines
  259.           everything between label-1 and label-2
  260.           from line 50 to label-1
  261.           from label-1 to the line with "HELP" in it
  262.  
  263.  
  264.      Line Number Merging
  265.  
  266.      BLED also supports  a  more  specialized  merge  much  like  the BASIC
  267.      merge.  Details  are given  below.   This line merge mode is just like
  268.      the BASIC merge command except that  logical blocks  of physical lines
  269.      replace the single physical line, and comment lines are supported.
  270.  
  271.      BLED  supports   the  specialized   line  number   merge  because  the
  272.      assumptions  greatly  simplify  the  merge  files.   No  special  BLED
  273.      commands are required:  no blocks, no block dispositions.  To insert a
  274.      line, just give it a line  number between  the original  line numbers.
  275.      To delete,  put only  the line  number in the merge file.  To replace,
  276.      use the same line number.
  277.  
  278.      The BLED line number merge treats all lines between line  numbers as a
  279.      single block,  i.e. as  if they  are one  single logical line, even if
  280.      they are multiple physical  and logical  lines.   For example,  in the
  281.      BASIC code
  282.  
  283.                200 X = X+1
  284.                    IF X>5 THEN_
  285.                      Y=0
  286.                210 Y = Y+1
  287.  
  288.      you might  think that  you could  delete the  first line 200 by having
  289.      "200" alone in the merge.   In fact,  the first  three lines  would be
  290.      deleted rather than the first only.
  291.  
  292.  
  293.      How to Invoke BLED
  294.  
  295.      BLED is invoked at DOS by typing
  296.  
  297.          BLED[/options] [spec-1] [spec-2] [spec-3] [spec-4] [spec-5]
  298.          where a spec has the format [drive:][\path\][filename]
  299.  
  300.      Everything in  brackets is  optional and  may be omitted.  The options
  301.      after BLED are
  302.           /B   -    run batch.  Means to ask no questions and automatically
  303.                     return  to  DOS  when  done.   Must be used with one of
  304.                     following options and requires first three specs.
  305.  
  306.           /F   -    file compare.  Means to produce a merge file which will
  307.                     transform spec-1  (old version) into spec-2.  Output is
  308.                     spec-3.
  309.  
  310.           /L   -    line number merge.  Do a  merge of  spec-2 into spec-1,
  311.                     based  on   line  number  identifiers  in  both  files,
  312.                     outputting to spec-3.
  313.  
  314.           /M   -    general merge based  on  BLED  commands.    Into spec-1
  315.                     merge spec-2, producing spec-3.
  316.  
  317.           /T=XXX -  test mode.  Do not process all line from master (first)
  318.                     file.  Instead, end the  run  after  processing  XXX (a
  319.                     number)  of  logical  lines  in  the master file.  Used
  320.                     mainly for testing BLED.  So you can  run against large
  321.                     real files without having to create smaller samples.
  322.  
  323.      Note:  /F,/L,/M  options  are  incompatible  and  at  most  one can be
  324.      specified.  BLED checks  for consistency  and required  parameters and
  325.      will abort  with an  error message  and help.  Optional parameters not
  326.      specified at DOS are supplied using full screen prompts.
  327.  
  328.      Spec-4 is used when you want to override the default warning file name
  329.      (WARNING is the default configuration value).  BLED keeps appending to
  330.      the warning file as long as you continue to run within it.   Each time
  331.      you reenter  BLED from  DOS, however,  BLED will begin overwriting the
  332.      warning file.  The override is useful if you want to preserve previous
  333.      warning files.
  334.  
  335.      Spec-5  is  for  overriding  the  default  configuration  file name of
  336.      BLED.CFG.
  337.  
  338.      Note:  the meaning of the first three file specs is different  for the
  339.      /F option.  Merges mean
  340.  
  341.                [source file]  [merges]   [source+merge]
  342.  
  343.      But for the /F option the specs mean
  344.  
  345.                [old version]  [new version]  [merges]
  346.  
  347.  
  348.      How BLED Runs
  349.  
  350.      BLED makes  a single pass through the original file, doing comparisons
  351.      to the second file.  Therefor all references to line  labels should be
  352.      in the  same order they occur in the original file.  BLED gives an on-
  353.      screen status report of what it is doing,  the files  it is  using, as
  354.      well as  counts of  the number  of records  it reads and writes at the
  355.      bottom of the screen.
  356.  
  357.      The Major BLED Functions
  358.  
  359.      The four major BLED functions are
  360.  
  361.      o    CONFIGURE.  General configuration parameters.
  362.  
  363.      o    FILE COMPARE.  Create a merge file.
  364.  
  365.      o    LINE MERGE.  Merge based on line number labels.
  366.  
  367.      o    MERGE.  Merge using explicit  BLED  block  and  block disposition
  368.           commands.
  369.  
  370.      The main menu in BLED uses the first letter of each choice.
  371.  
  372.  
  373.      CONFIGURE
  374.  
  375.      BLED  has  10  configuration  parameters,  which  are  stored  in  the
  376.      configuration file BLED.CFG.   If no  configuration file  exists, BLED
  377.      uses as a default parameters suitable for QuickBASIC.
  378.  
  379.      (1)  Default extension for source files.  If no extension is given for
  380.           source files, BLED will  add this.   Default  for this  option is
  381.           BAS.  Source files include spec-1, and also spec-3 for merges and
  382.           spec-2 for file compares.
  383.  
  384.      (2)  Default extension for changes to  source.    If  no  extension is
  385.           given for this file, BLED will add this.  Default for this option
  386.           is MRG.  In merges, this  applies to  spec-2.   In file compares,
  387.           this applies to spec-3.
  388.  
  389.      (3)  Character using to begin remarks in source.  Default character is
  390.           the single quote (').    When  looking  for  a  line continuation
  391.           character at  the end  of a line, BLED will ignore all text after
  392.           the remark character.
  393.  
  394.      (4)  BLED phrase indicating end of  block.    Used  with  INSERT BLOCK
  395.           command.   What follows is a block of code to be inserted.  Tells
  396.           BLED where the code ends.
  397.  
  398.      (5)  Character beginning a line  of  BLED  documentation.    BLED will
  399.           completely  ignore  a  line  beginning  with  this character when
  400.           merging.  Allows comments or documentation  to be  included right
  401.           in a merge file to explain changes.  The character need not be in
  402.           column 1 - only the first non-blank character.   Default  is "*".
  403.           The  documentation  character  should  never  occur  as the first
  404.           character in your source text.
  405.  
  406.      (6)  Character at end of  every alphanumeric  label.   Default is ":".
  407.           BLED assumes  that line  labels occur only as the first word in a
  408.           line.  Leading spaces are ignored,  so that  labels can  begin in
  409.           any column.   This label character is used by BLED to help locate
  410.           labels.  When specifying blocks in a BLED  command, you  need not
  411.           include the  end-character.   BLED knows,  for example, what when
  412.           you say "LABEL LOOPER" that "LOOPER:" is what  actually occurs in
  413.           the source code.
  414.  
  415.      (7)  Character beginning  BLED commands.   Default  is none.  BLED can
  416.           distinguish its commands from source code lines by when a command
  417.           is needed and by key phrase.  If confusion might result, however,
  418.           you can specify that  BLED commands  begin with  a character that
  419.           will never  occur at  the beginning  of a  line of  text, such as
  420.           possibly "$" or "-".
  421.  
  422.      (8)  Whether case is ignored in alphanumeric labels.   Default is yes,
  423.           so that "looper" and "LOOPER" are treated as the same.
  424.  
  425.      (9)  Line continuation  character.  One way for a logical line to span
  426.           multiple physical lines is to insert a special  line continuation
  427.           character at  the end  of a  line that logically continues on the
  428.           following line.  Default is  "_"  (underscore).    May  differ in
  429.           languages other  than QuickBASIC.   Many other freeform languages
  430.           use  a  statement  terminator   character.      Fortran   puts  a
  431.           continuation  character  in  column  6, which is not supported by
  432.           BLED.  (BLED can still work on FORTRAN files though.)
  433.  
  434.      (10) File that warning messages  are written  to.   From the  time you
  435.           enter BLED  until you  exit DOS,  BLED may issue warning messages
  436.           based on its  file  comparison  or  merge.    These  messages are
  437.           written to  this file  for perusal  later.  This way BLED can run
  438.           completely batch with no  loss of  information.   You can nullify
  439.           these  messages  by  making  the  file "NUL:" or send them to the
  440.           screen using  "SCRN:".   BLED will  report the  number of warning
  441.           messages during  its operation.   Sending  messages to the screen
  442.           will interfere with BLED's normal report  of its  progress on the
  443.           screen.  The default name for this warning is "WARNING".
  444.  
  445.      (11) Maximum number of physical lines in a logical line.  There are
  446.           several functions that require BLED to hold an entire logical
  447.           line in memory before it can decide what to do with the line.
  448.           For example, a file compare requires BLED to determine whether
  449.           there has been any change anywhere in common line numbers.
  450.           There are only so many physical lines that BLED can hold in
  451.           memory from a master or transaction file.  The default is 400.
  452.           This parameter allows the user to increase that number.
  453.  
  454.      (12) Preserve BLED comment lines.  It is important to be able to
  455.           append notes to source code to explain changes.  These can
  456.           be left permanently in the code by making them source code
  457.           comments.  But often it is desired to leave comments in the
  458.           text only temporily.  The only facility for doing this in
  459.           versions of BLED prior to 1.5 was to include special BLED
  460.           comment lines in a merge file which would be stripped out when
  461.           a merge was done.
  462.               For people who prefer to work with the full
  463.           source code rather than merges, and then to do a BLED file
  464.           compare against the original version to produce a BLED merge,
  465.           the explanations of changes got stripped and there was no good
  466.           way to add in temporary comments while making changes.  The
  467.           parameter to preserve BLED comment lines remedies these problems.
  468.           It will cause BLED comment lines to be kept as a specially formatted
  469.           source code comment in a merge.  The BLED comment lines will be
  470.           "floated" up to the top of the line number and the BLED comment
  471.           symbol (* by default) will be replaced by the source code comment
  472.           symbol (' by default) followed by "<" with the BLED comment symbol
  473.           followed by ">".  For example, "* Corrects spelling of VARIABLE"
  474.           becomes "'<*> Corrects spelling of VARIABLE".
  475.               Conversely, this parameter will cause source code comments in
  476.           the proper format to be converted to BLED comment lines in a
  477.           file compare that produces a merge.  This allows programmers who
  478.           work directly with the full source to insert temporary comments.
  479.           For example, "'<*> Moved here from line 830" becomes "* Moved here
  480.           from line 830".  By running this BLED generated merge with this
  481.           option off, so that BLED comment lines are stripped, the temporary
  482.           commentary goes deleted.
  483.               The default for this parameter is "N", so that persons desiring
  484.           to preserve BLED comments must edit and save the configuration.
  485.  
  486.           
  487.      FILE COMPARE
  488.  
  489.      The function  of this module is to produce a BLED merge file that will
  490.      convert an old version of a file to a new, modified version.  All that
  491.      is in the merge are the necessary changes.  This is a very complex and
  492.      difficult programming task which is only partially implemented  in the
  493.      current version.   The  file comparison will only work for source with
  494.      line number labels.  Essentially,  the  assumption  is  that  the line
  495.      number labels  are ordered  from low  to high  in both versions of the
  496.      file.  A comparison utility must  have  some  way  to  identify lines.
  497.      Ideally, this  constraint should  be relaxed  to apply to alphanumeric
  498.      labels with no assumptions about order.  Please send me  your ideas or
  499.      code changes  if you  think you  can solve this problem.  So, the ONLY
  500.      TYPE OF MERGE FILE THAT FILE COMPARISON WILL  PRODUCE IS  ONE FOR LINE
  501.      MERGING, and not for general merging.
  502.  
  503.      Operationally, this  means that  if you  are not using line numbers in
  504.      your source code, you should make  your  code  changes  directly  in a
  505.      merge file, and apply the merge file to produce the modified code.  If
  506.      you directly change the old version, there will  be no  way to isolate
  507.      just the changes later.
  508.  
  509.      NOTE: the BLED file compare is NOT A GENERAL FILE COMPARE.  General
  510.      file compares, like the DOS utility, compare two files by relative
  511.      byte position with a file.  BLED does a logical line by logical
  512.      line compare.  Apply the BLED file compare ONLY TO COMPILEABLE SOURCE
  513.      CODE, otherwise the result will be unpredictable.
  514.  
  515.  
  516.      LINE MERGE
  517.  
  518.      This  option  is  a  generalization  of  the BASIC merge command.  The
  519.      assumptions are that
  520.  
  521.      o    the lines of code are numbered at the beginning of a line.
  522.  
  523.      o    Physical lines of text are to be blocked from a line number up to
  524.           the next  line number.  The merge operates only on such blocks as
  525.           a unit.
  526.  
  527.      o    The line numbers are ordered from low to high in  both the source
  528.           and merge file.
  529.  
  530.      o    Lines in  the source  not in the merge file are to be kept, lines
  531.           in the merge not in the source are to be  inserted, and  lines in
  532.           both are  to be  replaced by  the line  (i.e. block) in the merge
  533.           file.
  534.  
  535.      o    Lines in the merge file with only a line number are to be deleted
  536.           from the source file.
  537.  
  538.      o    The merge maintains the low to high line number order.
  539.  
  540.  
  541.      MERGE
  542.  
  543.      The general  merge in  BLED allows  merges even when there are no line
  544.      numbers.  The BLED  commands are  BLOCK, INSERT,  DELETE, REPLACE, and
  545.      KEEP.  Each of these commands can be abbreviated by their first letter
  546.      (e.g "B FROM LINE 1 TO LINE 5" means "BLOCK FROM LINE  1 TO  LINE 5").
  547.      The syntax is
  548.  
  549.      BLOCK [FROM] [linetype] lineid [TO/UPTO/THRU] [linetype] lineid
  550.      [block disposition] [lineid]
  551.  
  552.      where [linetype] is LINE/LABEL/LABEL#/STRING.
  553.  
  554.      The BLOCK  command is  for marking  a block of text in the source file
  555.      (spec-1).  It must specify where the block begins and ends.  The first
  556.      three phrases  after BLOCK  identify the beginning, the last three the
  557.      end.   All phrases  enclosed in  brackets are  optional.   LINE is the
  558.      default linetype if none is specified.
  559.  
  560.      Linetype has four options.
  561.  
  562.      o    LINE means the physical line number, either absolute or relative.
  563.  
  564.      The lineid  distinguishes the two.  Absolute line numbers are positive
  565.      integers, relative line numbers  are  "*+n",  where  n  is  a positive
  566.      integer.
  567.  
  568.      o    LABEL means an alphanumeric label.
  569.  
  570.      o    LABEL# means a numeric line label (a positive integer).
  571.  
  572.      o    STRING means a string of characters.
  573.  
  574.      LABELS must be the first word on a line, STRINGS can occur anywhere in
  575.      a line.
  576.  
  577.      Lineid matches with the  linetype.   LABEL and  STRING require  a word
  578.      with any  characters.   LABEL# requires  a positive integer.  And line
  579.      requires either a positive  integer, or  the string  "*+" to  mean the
  580.      current line  in the  text file  plus" a  positive number, or the word
  581.      "END" to indicate thru the end of file.
  582.  
  583.      The phrase TO and UPTO are  equivalent.    They  mean  up  to  but not
  584.      including.    The  phrase  THRU  means  up  to and include.  TO is the
  585.      default if no phrase is specified.
  586.  
  587.      There are  three block  dispositions: KEEP/DELETE/REPLACE.   They tell
  588.      BLED what  to do  with a  defined block  and therefor  make sense only
  589.      after a BLOCK command.  DELETE deletes the block, KEEP keeps it.
  590.  
  591.           REPLACE [BLOCK/n]
  592.  
  593.      This replaces a defined block with  another.   The "n"  means that the
  594.      next n  physical lines  go in  place of  the defined block.  And BLOCK
  595.      means that all following lines up  to  the  end-block  phrase  are the
  596.      replacements.
  597.  
  598.      Another BLED command is to insert new lines.
  599.  
  600.           INSERT [BLOCK/n]
  601.  
  602.      This means  to insert  a block of lines at the current position in the
  603.      source file, i.e. just  before the  current line  that has  been read.
  604.      The "n"  means to  insert the  following n  physical lines.  The BLOCK
  605.      means to take all following lines up to the end-block phrase.
  606.  
  607.      EXAMPLES
  608.  
  609.         (SOURCE)                           (MERGES)
  610.      CALL INITIALIZE              BLOCK FROM LINE 1 TO STRING OPENFILES
  611.      GOSUB OPENFILES              REPLACE 1
  612.      LOOPER:                      CALL HELP
  613.      IF X=1 THEN GOTO ALLDONE:    BLOCK FROM LINE * THRU LABEL ALLDONE 
  614.      X = X+1                      KEEP
  615.      GOTO LOOPER                  INSERT BLOCK
  616.      ALLDONE:                     CLOSE
  617.      END                          ENDBLOCK
  618.                       (RESULT)
  619.                    CALL HELP
  620.                    GOSUB OPENFILES
  621.                    LOOPER:
  622.                    IF X=1 THEN GOTO ALLDONE:
  623.                    X = X+1
  624.                    GOTO LOOPER
  625.                    ALLDONE:
  626.                    CLOSE
  627.                    END
  628.  
  629.               (SOURCE)                    (LINE MERGE)
  630.      110 IF GOT.COMMAND THEN_     115 NO.HELP = -1
  631.            IF NO.HELP THEN_       150 IF HELPFUL THEN_
  632.              PRINT "SORRY"              WHILE X>5 AND NOT EOF(2):_
  633.      120 GOSUB CHKFILES                   GOSUB CHECKER:_
  634.      150 IF HELPFUL THEN_               WEND
  635.             WHILE X>5:_           200
  636.               GOSUB CHECKER:_     220 END
  637.             WEND
  638.      200 IF X>10 THEN X=12
  639.  
  640.                          (RESULT)
  641.                   100 IF GOT.COMMAND THEN_
  642.                         IF NO.HELP THEN_
  643.                           PRINT "SORRY"
  644.                   115 NO.HELP = -1
  645.                   120 GOSUB CHKFILES
  646.                   150 IF HELPFUL THEN_
  647.                         WHILE X>5 AND NOT EOF(2):_
  648.                           GOSUB CHECKER:_
  649.                         WEND
  650.                   220 END
  651.  
  652.  
  653.      Stylistic Considerations
  654.  
  655.      A good merge file includes the following information at the top of the
  656.      file.
  657.  
  658.      o    author
  659.  
  660.      o    date of merge
  661.  
  662.      o    what merge is to be applied to
  663.  
  664.      o    how to apply the merge (line number merge, general merge?)
  665.  
  666.      o    a list of the general fixes or enhancements made, listed in order
  667.           of most to least important coupled.
  668.  
  669.      In the body of the merge the following documentation should be
  670.      included.
  671.  
  672.      o    a line by line explanation of the changes made stating what is
  673.           changed and why.  The explanation should precede the line.
  674.  
  675.      o    lines should be grouped together if they implement a common
  676.           function.
  677.  
  678.                           A Model Merge File
  679.  
  680.      ***************************************************************** 
  681.      *  EXAMPLE.MRG                                                  * 
  682.      *  by Ken Goosens   Jan 1, 1986                                 * 
  683.      *                                                               * 
  684.      *  to be applied to BLED.BAS version 1.1                        * 
  685.      *  using the general merge of BLED.EXE                          * 
  686.      *                                                               * 
  687.      *  This merge makes two changes:                                * 
  688.      *     (1) the defaults when no configuration exists are changed * 
  689.      *         to be appropriate for TURBO Pascal rather than        * 
  690.      *         QuickBASIC.                                           * 
  691.      *     (2) The warning message when no configuration file exists * 
  692.      *         is changed to beep and delay for 3 seconds rather     * 
  693.      *         than quietly and hurriedly display.                   * 
  694.      ***************************************************************** 
  695.       
  696.      * reset extensions for original and new files to "PAS" 
  697.       
  698.         BLOCK FROM LABEL USEDEFAULTS TO STRING ENDBLK 
  699.         REPLACE BLOCK 
  700.         USEDEFAULTS:      
  701.           DEORIGFILE$ = "PAS"  
  702.           DEBTCHCMDS$ = "MRG"  
  703.           DENEWFILE$  = "PAS"  
  704.         ENDBLOCK 
  705.       
  706.      * Change call from EXPLAIN to EXPERR 
  707.       
  708.      BLOCK FROM LABEL ERROPEN THRU STRING CALL 
  709.      REPLACE BLOCK 
  710.      ERROPEN:  
  711.         X$ = "Error"+STR$(ERR)+" opening file "+FF$  
  712.         CALL EXPERR (X$)  
  713.      ENDBLOCK 
  714.  
  715.  
  716.      How to Recompile BLED
  717.  
  718.      BLED is written in QuickBasic and is distributed with the source
  719.      code.  People wishing to modify or fix the source code can recompile
  720.      the code as follows.
  721.  
  722.      QB UTILBLED /G/O;
  723.      QB BLED ,,/G/O/X;
  724.      LINK BLED+UTILBLED,,NUL.MAP,advbas
  725.